package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserArticleDao;
import com.financing.wap.dto.DstUserArticleDTO;
import com.financing.wap.service.IDstUserArticleService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_article  
 * 用户文章关联 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserArticleService")
public class DstUserArticleServiceImpl implements IDstUserArticleService{

	@Autowired
	private IDstUserArticleDao dstUserArticleDao;

	@Override
	public int insert(DstUserArticleDTO dstUserArticle) throws SQLException {
		dstUserArticle.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserArticleDao.insert(dstUserArticle);
	}

	@Override
	public void update(DstUserArticleDTO dstUserArticle) throws SQLException {
		dstUserArticleDao.update(dstUserArticle);
	}

	@Override
	public void updateForce(DstUserArticleDTO dstUserArticle) throws SQLException {
		dstUserArticleDao.updateForce(dstUserArticle);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserArticleDao.delete(id);
	}
	
	@Override
	public List<DstUserArticleDTO> queryList(DstUserArticleDTO dstUserArticle) throws SQLException {
		return dstUserArticleDao.queryList(dstUserArticle);
	}

	@Override
	public int queryListCount(DstUserArticleDTO dstUserArticle) throws SQLException {
		return dstUserArticleDao.queryListCount(dstUserArticle);
	}

	@Override
	public DstUserArticleDTO loadById(Integer id) throws SQLException {
		return dstUserArticleDao.loadById(id);
	}
 	@Override
	public DstUserArticleDTO queryListGetFirst(DstUserArticleDTO dstUserArticle)
			throws SQLException {
		 List<DstUserArticleDTO> queryList = queryList(dstUserArticle);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserArticleDTO();
		 }
		 return queryList.get(0);
	}
}
